const API = require('../../pages/api/index')
const {
  typeJson
} = require('../../utils/typejson')
let prolist = wx.getStorageSync('prolist') == '' ? wx.getStorageSync('prolist') : JSON.parse(wx.getStorageSync('prolist'))


Page({

  /**
   * 页面的初始数据
   */
  data: {
    pulldown: "",
    pullup: 2,
    prolist: wx.getStorageSync('prolist') == '' ? wx.getStorageSync('prolist') : JSON.parse(wx.getStorageSync('prolist')),
    listConfig: [{
        label: "发现时间",
        prop: "discoverDate",

      },
      {
        label: "隐患部位",
        prop: "part",
      },
    ],
    slide: {
      slideButton: {
        type: 'warn',
        text: '核查',
        extClass: 'test',
        src: '/page/weui/cell/icon_star.svg', // icon的路径
      },

      formConfig: [{
          label: '整改要求',
          prop: 'rectifyRequire',
          type: "textarea",

        },
        {
          label: '整改类型',
          prop: 'rectifyType',
          type: 'dropDown',
          jsonType: typeJson.rectifyType,
          required: true,

        },
        {
          label: '整改方式',
          prop: 'rectifyWay',
          type: 'dropDown',
          jsonType: typeJson.rectifyWay,
          required: true,


        },
        {
          label: '整改期限',
          prop: 'rectifyExpires',
          type: 'date',

        },
        {
          label: '整改人',
          prop: 'rectifyManId',
          type: 'dddropDownSearch',
          hidden: 'look',
          required: true,
          net: {
            url: '/system/user/list',
            method: 'get',
            key: 'nickName',
            data: {
              mineId: true,
            },
            value: 'memberId'
          }
        },
        {
          label: "整改确认人",
          prop: "rectifyConfirmId",
          type: 'dddropDownSearch',
          hidden: 'look',
          required: true,
          net: {
            url: '/system/user/list',
            method: 'get',
            key: 'nickName',
            data: {
              mineId: true,
            },
            value: 'memberId'
          }
        },

        {
          label: '联系电话',
          prop: 'phone',
        },
        {
          label: '',
          prop: 'verifyManSign',
          type: 'canvas',
        },

      ]
    },


    formConfig: [{
        label: "核查人",
        prop: "verifyManId",
        hidden: "all",
        tag: "userid",

        //  hidden: 'look',
      },

      {
        label: "隐患描述",
        prop: "content",
        type: "textarea",
        hidden: 'edit',
      },
      {
        label: "来源",
        prop: "source",
        jsonType: typeJson.source,
        type: "dropDown",
        hidden: 'edit',
      },
      {
        label: "隐患部位",
        prop: "part",
        hidden: 'edit',
      },
      {
        label: "隐患级别",
        prop: "level",
        type: "dropDown",
        jsonType: typeJson.level,
        hidden: 'edit',
      },

      {
        label: "发现人",
        prop: "discoverPerson",
        hidden: 'edit',
      },
      {
        label: "核查人",
        prop: "verifyManId",
        hidden: 'edit',

        type: 'dropDownSearch',

        net: {
          url: '/app/memberinfo/getList',
          method: 'post',
          key: 'nickName',
          data: {
            mineId: true,
          },
          value: 'memberId'
        }
      },
      {
        label: "发现时间",
        prop: "discoverDate",
        type: "date",
        hidden: 'edit',
      },

      {
        label: "核查时间",
        prop: "verifyDate",
        type: "date",
        hidden: 'edit',
      },
      {
        label: "核查状态",
        prop: "verifyStatus",
        type: "dropDown",
        hidden: 'edit',
        jsonType: typeJson.verifyStatus,

      },

      {
        label: '整改要求',
        prop: 'rectifyRequire',
        type: "textarea",

      },
      {
        label: '整改类型',
        prop: 'rectifyType',
        type: 'dropDown',
        jsonType: typeJson.rectifyType,
        required: true,

      },
      {
        label: '整改方式',
        prop: 'rectifyWay',
        type: 'dropDown',
        jsonType: typeJson.rectifyWay,
        required: true,


      },
      {
        label: '整改期限',
        prop: 'rectifyExpires',
        type: 'date',

      },
      {
        label: '整改人',
        prop: 'rectifyManId',
        type: 'dropDownSearch',
        hidden: 'look',
        required: true,
        net: {
          url: '/app/memberinfo/getUserAndPhone',
          method: 'post',
          key: 'nickName',
          data: {
            mineId: true,
          },
          value: 'memberId'
        }
      },

      {
        label: '联系电话',
        prop: 'phone',
      },

    ],


    net: {

      select: {
        url: `/app/riskExcludeNew/getList`,
        method: 'post',
        data: {
          mineId: true,
          checkType: "2"

        }
      },
      delete: {
        url: '/app/riskExcludeNew/delete',
        method: 'get',
        data: {

        }
      },
      insert: {
        url: '/app/riskExcludeNew/insert',
        method: 'post',
        data: {
          mineId: true,
          discoverManId: "userid",

        }
      },
      update: {
        url: '/app/riskExcludeNew/update',
        method: 'post',
        data: {
          verifyStatus: 1
        }
      }


    },
    showCom: true
  },




  /**
   * 生命周期函数--监听页面加载
   */


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

    this.setData({
      showCom: false
    });
    this.setData({
      showCom: true
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },


  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh()
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.setData({
      pullup: this.data.pullup + 1
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})